package com.javen.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.javen.model.Answer;
import com.javen.service.IAnswerService;

@Controller
@RequestMapping("/answer")
/// answer/**
public class AnswerController {

	private static Logger log = LoggerFactory.getLogger(AnswerController.class);

	@Resource
	private IAnswerService answerService;

	// answer/submit
	@RequestMapping(value = "/submit", method = RequestMethod.POST)
	@ResponseBody
	public String AnswerSubmit(
			@RequestParam(required = false, value = "customerArray") List<Answer> answers,
			 HttpServletRequest request, HttpSession session)
			throws Exception {

		System.out.println("测试:进入AnswerController");

		if (answers == null || answers.size() <= 0) {
			return "No any ID.中文";
		}

		int insertAnswer = answerService.getAnswer(answers);
		System.out.println("测试:" + insertAnswer);

		return "insertAnswer";
	}

/*	
	@RequestMapping(value = "/confirmRandomSampleList")
	@ResponseBody
	public JSONObject confirmRandomSampleList (@RequestParam(required = false, value = "userCodeArr[]") List<String> userCodeArr, @RequestParam(required = false, value = "startdate") String startdate, @RequestParam(required = false, value = "enddate") String enddate) {
		Map map = new HashMap();
 
		map.put("result","success");
		return JSONObject.fromObject(map);
	}
	*/
	
	
	
	
}
